#pragma once

#include "RoomDefines.h"
#include "IContractChecker.h"
#include "SimpleCriticalSection.h"

namespace RoomFW {

class ProtocolFactory
{
public:
	static void Register(IContractCheckerSPC contract);
	static IContractCheckerSPC Get(ContractTypeId typeId, bool conjugate = false);

private:
	typedef std::pair<IContractCheckerSPC, IContractCheckerSPC> ProtocolPair;
	typedef std::map<ContractTypeId, ProtocolPair> ProtocolMap;
	static ProtocolMap& GetProtocolMap();
	static CriticalSectionGuard Guard();
};

struct ProtocolFactoryRegistration
{
	ProtocolFactoryRegistration(IContractCheckerSPC contract);
};

}
